﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;

namespace Teigha.Core
{
	public class OdGeSurface : OdGeEntity3d
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdGeSurface(IntPtr cPtr, bool cMemoryOwn) : base(GlobalsPINVOKE.OdGeSurface_SWIGUpcast(cPtr), cMemoryOwn)
		{
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdGeSurface obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdGeSurface()
		{
			this.Dispose();
		}

		public override void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							GlobalsPINVOKE.delete_OdGeSurface(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
			base.Dispose();
		}

		public OdGePoint2d paramOf(OdGePoint3d point, OdGeTol tol)
		{
			OdGePoint2d result = new OdGePoint2d(GlobalsPINVOKE.OdGeSurface_paramOf__SWIG_0(this.swigCPtr, OdGePoint3d.getCPtr(point), OdGeTol.getCPtr(tol)), true);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGePoint2d paramOf(OdGePoint3d point)
		{
			OdGePoint2d result = new OdGePoint2d(GlobalsPINVOKE.OdGeSurface_paramOf__SWIG_1(this.swigCPtr, OdGePoint3d.getCPtr(point)), true);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool isOn(OdGePoint3d point, OdGePoint2d paramPoint, OdGeTol tol)
		{
			bool result = GlobalsPINVOKE.OdGeSurface_isOn__SWIG_0(this.swigCPtr, OdGePoint3d.getCPtr(point), OdGePoint2d.getCPtr(paramPoint), OdGeTol.getCPtr(tol));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool isOn(OdGePoint3d point, OdGePoint2d paramPoint)
		{
			bool result = GlobalsPINVOKE.OdGeSurface_isOn__SWIG_1(this.swigCPtr, OdGePoint3d.getCPtr(point), OdGePoint2d.getCPtr(paramPoint));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGePoint3d closestPointTo(OdGePoint3d point, OdGeTol tol)
		{
			OdGePoint3d result = new OdGePoint3d(GlobalsPINVOKE.OdGeSurface_closestPointTo__SWIG_0(this.swigCPtr, OdGePoint3d.getCPtr(point), OdGeTol.getCPtr(tol)), true);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGePoint3d closestPointTo(OdGePoint3d point)
		{
			OdGePoint3d result = new OdGePoint3d(GlobalsPINVOKE.OdGeSurface_closestPointTo__SWIG_1(this.swigCPtr, OdGePoint3d.getCPtr(point)), true);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void getClosestPointTo(OdGePoint3d point, OdGePointOnSurface pntOnSurface, OdGeTol tol)
		{
			GlobalsPINVOKE.OdGeSurface_getClosestPointTo__SWIG_0(this.swigCPtr, OdGePoint3d.getCPtr(point), OdGePointOnSurface.getCPtr(pntOnSurface), OdGeTol.getCPtr(tol));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void getClosestPointTo(OdGePoint3d point, OdGePointOnSurface pntOnSurface)
		{
			GlobalsPINVOKE.OdGeSurface_getClosestPointTo__SWIG_1(this.swigCPtr, OdGePoint3d.getCPtr(point), OdGePointOnSurface.getCPtr(pntOnSurface));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public double distanceTo(OdGePoint3d point, OdGeTol tol)
		{
			double result = GlobalsPINVOKE.OdGeSurface_distanceTo__SWIG_0(this.swigCPtr, OdGePoint3d.getCPtr(point), OdGeTol.getCPtr(tol));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public double distanceTo(OdGePoint3d point)
		{
			double result = GlobalsPINVOKE.OdGeSurface_distanceTo__SWIG_1(this.swigCPtr, OdGePoint3d.getCPtr(point));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool isNormalReversed()
		{
			bool result = GlobalsPINVOKE.OdGeSurface_isNormalReversed(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGeSurface reverseNormal()
		{
			OdGeSurface result = new OdGeSurface(GlobalsPINVOKE.OdGeSurface_reverseNormal(this.swigCPtr), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void getEnvelope(OdGeInterval intrvlU, OdGeInterval intrvlV)
		{
			GlobalsPINVOKE.OdGeSurface_getEnvelope(this.swigCPtr, OdGeInterval.getCPtr(intrvlU), OdGeInterval.getCPtr(intrvlV));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public bool isClosedInU(OdGeTol tol)
		{
			bool result = GlobalsPINVOKE.OdGeSurface_isClosedInU__SWIG_0(this.swigCPtr, OdGeTol.getCPtr(tol));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool isClosedInU()
		{
			bool result = GlobalsPINVOKE.OdGeSurface_isClosedInU__SWIG_1(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool isClosedInV(OdGeTol tol)
		{
			bool result = GlobalsPINVOKE.OdGeSurface_isClosedInV__SWIG_0(this.swigCPtr, OdGeTol.getCPtr(tol));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool isClosedInV()
		{
			bool result = GlobalsPINVOKE.OdGeSurface_isClosedInV__SWIG_1(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGePoint3d evalPoint(OdGePoint2d param)
		{
			OdGePoint3d result = new OdGePoint3d(GlobalsPINVOKE.OdGeSurface_evalPoint__SWIG_0(this.swigCPtr, OdGePoint2d.getCPtr(param)), true);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGePoint3d evalPoint(OdGePoint2d param, int numDeriv, OdGeVector3dArray derivatives)
		{
			OdGePoint3d result = new OdGePoint3d(GlobalsPINVOKE.OdGeSurface_evalPoint__SWIG_1(this.swigCPtr, OdGePoint2d.getCPtr(param), numDeriv, OdGeVector3dArray.getCPtr(derivatives)), true);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGePoint3d evalPoint(OdGePoint2d param, int numDeriv, OdGeVector3dArray derivatives, OdGeVector3d normal)
		{
			OdGePoint3d result = new OdGePoint3d(GlobalsPINVOKE.OdGeSurface_evalPoint__SWIG_2(this.swigCPtr, OdGePoint2d.getCPtr(param), numDeriv, OdGeVector3dArray.getCPtr(derivatives), OdGeVector3d.getCPtr(normal)), true);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGeSurface Assign(OdGeSurface surf)
		{
			OdGeSurface result = new OdGeSurface(GlobalsPINVOKE.OdGeSurface_Assign(this.swigCPtr, OdGeSurface.getCPtr(surf)), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool project(OdGePoint3d p, OdGePoint3d projP, OdGeTol tol)
		{
			bool result = GlobalsPINVOKE.OdGeSurface_project__SWIG_0(this.swigCPtr, OdGePoint3d.getCPtr(p), OdGePoint3d.getCPtr(projP), OdGeTol.getCPtr(tol));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool project(OdGePoint3d p, OdGePoint3d projP)
		{
			bool result = GlobalsPINVOKE.OdGeSurface_project__SWIG_1(this.swigCPtr, OdGePoint3d.getCPtr(p), OdGePoint3d.getCPtr(projP));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		private object locker = new object();

		private HandleRef swigCPtr;
	}
}
